<script setup>
    import { nextTick, ref } from 'vue';  
    const isShow = ref(false)
    const inpRef = ref(null)
    const handleShow = () => {
        isShow.value = !isShow.value
        if(isShow.value) {
            nextTick(() => {
                inpRef.value.focus()
            })
        }
    }
</script>
    
<template>
    <button @click="handleShow">编辑</button>
    <input type="text" name="" id="" v-if="isShow" ref="inpRef">
</template>
    
<style>
    
</style>